***Cleaning and compiling data***
clear
use "MTurk1.dta"
keep sudanoutcome minwageoutcome dem
rename sudanoutcome sudan
rename minwageoutcome minwage
g study = "MTurk1"
save "study1.dta", replace

clear
use "MTurk2.dta"
keep dem sudanoutcome minwageoutcome covidamount
rename sudanoutcome sudan
rename minwageoutcome minwage
rename covidamount covid
g study = "MTurk2"
save "study2.dta", replace

clear
use "YouGov.dta"
keep dem leaner *outcome weight
drop inf_binary
rename sudanoutcome sudan
rename minwageoutcome minwage
rename refugeeoutcome refugee
rename infrastructureoutcome infrastructure
g study = "YouGov1"
save "study3.dta", replace

clear
import spss using "UCHI0012_OUTPUT.sav"
g dem = .
replace dem = 1 if pid7 <= 3
replace dem = 0 if pid7 >= 5 & pid7 <= 7
g leaner = pid7 == 3 | pid7 == 5
g police = cv_policing
g abortion = cv_pregnancy
g minwage = cv_wage
keep dem leaner police abortion minwage weight
g study = "YouGov2"
save "study4.dta", replace

clear
use "lucid_survey_all_matched.dta"
*drop duplicates 
sort StartDate EndDate mw_local
drop if StartDate == StartDate[_n-1] & EndDate == EndDate[_n-1] & mw_local == mw_local[_n-1]
keep republican democrat mw_local
g dem = .
replace dem = 1 if democrat == 1
replace dem = 0 if republican == 1
drop democrat republican
g study = "Lucid"
rename mw_local localminwage
drop if localminwage == .
save "study5.dta", replace

clear 
use "CCES23_Common_Output.dta"
rename commonweight weight
g dem = .
replace dem = 1 if pid7 <= 3
replace dem = 0 if pid7 >= 5 & pid7 <= 7
g leaner = pid7 == 3 | pid7 == 5
rename CC23_325 abortion
drop if abortion > 40
keep dem leaner abortion weight
g study = "CES2023"
save "study6.dta", replace

clear
use "study1.dta"
append using "study2.dta"
append using "study3.dta"
append using "study4.dta"
append using "study5.dta"
append using "study6.dta"
order study dem leaner localminwage minwage sudan covid refugee infrastructure police abortion

drop if localminwage == . & minwage == . & sudan == . & covid == . & refugee == . & infrastructure == . & police == . & abortion == .

replace weight = 1 if weight == .
table study, statistic(mean weight)
table study, statistic(min weight)
table study, statistic(max weight)
tab study
save "CleanedData.dta", replace

forvalues i = 1/6 {
erase "study`i'.dta"
}


***Discussion of corporate tax rate question in text***
clear
use "CES24_Common.dta"
rename commonweight weight
g corporatetax = CC24_341b == 1
drop if CC24_341b == .
*57 percent support raising corporate tax rate to 28 percent
tab corporatetax [aw = weight]
*83 percent of Democrats and 33 percent of Republicans support this
table pid3 [aw = weight], statistic(mean corporatetax)


***Figure 1***
clear
set seed 60637
set obs 200000
g elite = uniform() < .5
g dem = uniform() < .5
g ideology = invnormal(uniform()) if elite == 0
replace ideology = invnormal(uniform())*.5 + 1.5 if elite == 1 & dem == 0
replace ideology = invnormal(uniform())*.5 - 1.5 if elite == 1 & dem == 1
g binary1 = ideology > .8
g binary2 = ideology > -.8
corr binary1 binary2 if elite == 1
corr binary1 binary2 if elite == 0
kdensity ideology if elite == 1, nograph gen(k_elite) at(ideology) bw(.2)
kdensity ideology if elite == 0, nograph gen(k_public) at(ideology) bw(.2)
sort ideology
graph twoway line k_elite k_public ideology if abs(ideology) <= 3, xline(.8) xline(-.8)
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .style.editstyle declared_xsize(6) editcopy
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle margin(zero) editcopy
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Ideology
gr_edit .xaxis1.reset_rule -3 3 1 , tickset(major) ruletype(range) 
gr_edit .plotregion1.plot1.style.editstyle line(color(green) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(chocolate) width(medthick)) editcopy
gr_edit .plotregion1.AddTextBox added_text editor .31 1.87
gr_edit .plotregion1.added_text_new = 1
gr_edit .plotregion1.added_text_rec = 1
gr_edit .plotregion1.added_text[1].style.editstyle  angle(default) size(small) color(green) horizontal(left) vertical(middle) margin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) linegap( sztype(relative) val(0) allow_pct(1)) drawbox(no) boxmargin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) fillcolor(bluishgray) linestyle( width( sztype(relative) val(.2) allow_pct(1)) color(black) pattern(solid) align(inside)) box_alignment(east) editcopy
gr_edit .plotregion1.added_text[1].text = {}
gr_edit .plotregion1.added_text[1].text.Arrpush Elites (r = .85)
gr_edit .plotregion1.AddTextBox added_text editor .35 -.415
gr_edit .plotregion1.added_text_new = 2
gr_edit .plotregion1.added_text_rec = 2
gr_edit .plotregion1.added_text[2].style.editstyle  angle(default) size(small) color(chocolate) horizontal(left) vertical(middle) margin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) linegap( sztype(relative) val(0) allow_pct(1)) drawbox(no) boxmargin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) fillcolor(bluishgray) linestyle( width( sztype(relative) val(.2) allow_pct(1)) color(black) pattern(solid) align(inside)) box_alignment(east) editcopy
gr_edit .plotregion1.added_text[2].style.editstyle size(small) editcopy
gr_edit .plotregion1.added_text[2].text = {}
gr_edit .plotregion1.added_text[2].text.Arrpush Public (r = .27)
gr_edit .plotregion1.AddTextBox added_text editor .04 -.95
gr_edit .plotregion1.added_text_new = 3
gr_edit .plotregion1.added_text_rec = 3
gr_edit .plotregion1.added_text[3].style.editstyle  angle(default) size(small) color(black) horizontal(left) vertical(middle) margin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) linegap( sztype(relative) val(0) allow_pct(1)) drawbox(no) boxmargin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) fillcolor(bluishgray) linestyle( width( sztype(relative) val(.2) allow_pct(1)) color(black) pattern(solid) align(inside)) box_alignment(east) editcopy
gr_edit .plotregion1.added_text[3]._set_orientation vertical
gr_edit .plotregion1.added_text[3].text = {}
gr_edit .plotregion1.added_text[3].text.Arrpush Cutpoint for Q1
gr_edit .plotregion1.AddTextBox added_text editor .04 .82
gr_edit .plotregion1.added_text_new = 4
gr_edit .plotregion1.added_text_rec = 4
gr_edit .plotregion1.added_text[4].style.editstyle  angle(default) size(small) color(black) horizontal(left) vertical(middle) margin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) linegap( sztype(relative) val(0) allow_pct(1)) drawbox(no) boxmargin( gleft( sztype(relative) val(0) allow_pct(1)) gright( sztype(relative) val(0) allow_pct(1)) gtop( sztype(relative) val(0) allow_pct(1)) gbottom( sztype(relative) val(0) allow_pct(1))) fillcolor(bluishgray) linestyle( width( sztype(relative) val(.2) allow_pct(1)) color(black) pattern(solid) align(inside)) box_alignment(east) editcopy
gr_edit .plotregion1.added_text[4]._set_orientation vertical
gr_edit .plotregion1.added_text[4].text = {}
gr_edit .plotregion1.added_text[4].text.Arrpush Cutpoint for Q2
graph export "Figure1.png", replace as(png)


***Table 3 + additional stats reported in text***
clear
postutil clear
use "CleanedData.dta"
replace leaner = 0 if leaner == .
g rep = dem == 0
g full = 1

*stats in text*
g minwagezero = minwage == 0 if minwage != .
g minwage25 = minwage >= 25 if minwage != .
g minwageabovestatusquo = minwage > 7.25 if minwage != .
g minwagebelow15 = minwage < 15 if minwage != .
g policelower = police < 500 if police != .
g defundpolice = police == 0 if police != .
g abortion0 = abortion == 0 if abortion != .
g abortion40 = abortion == 40 if abortion != .

*3 percent for eradicating minimum wage
sum minwagezero [aw = weight]

*3 percent for minimum wage of 25 or more
sum minwage25 [aw = weight]

*97 percent of Democrats want a minimum wage below 25
sum minwage25 [aw = weight] if dem == 1

*87 percent want to raise the minimum wage
sum minwageabovestatusquo [aw = weight]

*77 percent of Republicans want to raise the minimum wage
sum minwageabovestatusquo [aw = weight] if dem == 0 

*61 percent want a minimum wage below 15
sum minwagebelow15 [aw = weight]

*41 percent of Democrats want a minimum wage below 15
sum minwagebelow15 [aw = weight] if dem == 1 

*24 percent want to reduce police spending
sum policelower [aw = weight]

*2 percent want to fully defund the police
sum defundpolice [aw = weight]

*13 percent say abortion should not be legal at any point
sum abortion0  [aw = weight]

*9 percent say abortion should be legal through all 40 weeks of a pregnancy
sum abortion40 [aw = weight]

*How many unique responses to each question? (At least 40 responses to all questions, 649 in the case of local minimum wage)
foreach i in minwage localminwage sudan covid refugee infrastructure police abortion {
egen `i'id = group(`i')
sum `i'id
}

*19 percent answered the federal minimum wage question not in whole dollars
g minwagewhole = minwage == round(minwage)
tab minwagewhole if minwage != . [aw = weight]

*25 percent answered the local minimum wage question not in whole dollars
g localminwagewhole = localminwage == round(localminwage)
tab localminwagewhole if localminwage != . [aw = weight]


*Table 3*
postfile Results str20 issue str4 sample mode mean sd p10 p25 p50 p75 p90 n using "Table3.dta", replace
foreach i in localminwage minwage sudan covid refugee infrastructure police abortion {
foreach j in dem full rep {
preserve
keep if `j' == 1
drop if `i' == .
egen uniqueresponse = group(`i')
egen weightedfrequency = sum(weight), by(uniqueresponse)
egen maxfreq = max(weightedfrequency)
tab `i' if weightedfrequency == maxfreq
sum `i' if weightedfrequency == maxfreq
scalar mode = r(mean)
summarize `i' [aw = weight], d
scalar mean = r(mean)
scalar sd = r(sd)
scalar p10 = r(p10)
scalar p25 = r(p25)
scalar p50 = r(p50)
scalar p75 = r(p75)
scalar p90 = r(p90)
scalar n = r(N)
post Results ("`i'") ("`j'") (mode) (mean) (sd) (p10) (p25) (p50) (p75) (p90) (n) 
restore
}
}
postclose Results
clear
use "Table3.dta"


***Figure 2***
clear
use "CleanedData.dta"
replace leaner = 0 if leaner == .
g all = 1
g rep = dem == 0
replace rep = . if dem == .
*top and bottom code to the 1st and 99th percentiles
foreach i in localminwage minwage sudan covid refugee infrastructure police abortion {
sum `i' [aw = weight], d
replace `i' = r(p99) if `i' > r(p99) & `i' != .
}

*local minwage
sum localminwage
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity localminwage [aw = weight], gen(k_localminwage_all) at(x) bw(`bw') nograph
kdensity localminwage if dem == 1 & leaner == 0 [aw = weight], gen(k_localminwage_dem) at(x) bw(`bw') nograph
kdensity localminwage if dem == 0 & leaner == 0 [aw = weight], gen(k_localminwage_rep) at(x) bw(`bw') nograph
sum k_localminwage_dem
scalar maxval = r(max)
sum k_localminwage_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum localminwage if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_localminwage_dem k_localminwage_rep k_localminwage_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Local minimum wage ({c $|}/hr)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_localminwage.gph", replace
drop x k_*

*minwage
sum minwage
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity minwage [aw = weight], gen(k_minwage_all) at(x) bw(`bw') nograph
kdensity minwage if dem == 1 & leaner == 0 [aw = weight], gen(k_minwage_dem) at(x) bw(`bw') nograph
kdensity minwage if dem == 0 & leaner == 0 [aw = weight], gen(k_minwage_rep) at(x) bw(`bw') nograph
sum k_minwage_dem
scalar maxval = r(max)
sum k_minwage_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum minwage if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_minwage_dem k_minwage_rep k_minwage_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Federal minimum wage ({c $|}/hr)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_minwage.gph", replace
drop x k_*

*sudan
sum sudan
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity sudan [aw = weight], gen(k_sudan_all) at(x) bw(`bw') nograph
kdensity sudan if dem == 1 & leaner == 0 [aw = weight], gen(k_sudan_dem) at(x) bw(`bw') nograph
kdensity sudan if dem == 0 & leaner == 0 [aw = weight], gen(k_sudan_rep) at(x) bw(`bw') nograph
sum k_sudan_dem
scalar maxval = r(max)
sum k_sudan_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum sudan if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_sudan_dem k_sudan_rep k_sudan_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Federal Aid to South Sudan ({c $|}100M)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_sudan.gph", replace
drop x k_*

*covid
sum covid
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity covid [aw = weight], gen(k_covid_all) at(x) bw(`bw') nograph
kdensity covid if dem == 1 & leaner == 0 [aw = weight], gen(k_covid_dem) at(x) bw(`bw') nograph
kdensity covid if dem == 0 & leaner == 0 [aw = weight], gen(k_covid_rep) at(x) bw(`bw') nograph
sum k_covid_dem
scalar maxval = r(max)
sum k_covid_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum covid if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_covid_dem k_covid_rep k_covid_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush COVID relief spending ({c $|}T)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_covid.gph", replace
drop x k_*

*infrastructure
sum infrastructure
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity infrastructure [aw = weight], gen(k_infrastructure_all) at(x) bw(`bw') nograph
kdensity infrastructure if dem == 1 & leaner == 0 [aw = weight], gen(k_infrastructure_dem) at(x) bw(`bw') nograph
kdensity infrastructure if dem == 0 & leaner == 0 [aw = weight], gen(k_infrastructure_rep) at(x) bw(`bw') nograph
sum k_infrastructure_dem
scalar maxval = r(max)
sum k_infrastructure_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum infrastructure if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_infrastructure_dem k_infrastructure_rep k_infrastructure_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Infrastructure spending ({c $|}T)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_infrastructure.gph", replace
drop x k_*

*abortion
sum abortion
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity abortion [aw = weight], gen(k_abortion_all) at(x) bw(`bw') nograph
kdensity abortion if dem == 1 & leaner == 0 [aw = weight], gen(k_abortion_dem) at(x) bw(`bw') nograph
kdensity abortion if dem == 0 & leaner == 0 [aw = weight], gen(k_abortion_rep) at(x) bw(`bw') nograph
sum k_abortion_dem
scalar maxval = r(max)
sum k_abortion_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum abortion if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_abortion_dem k_abortion_rep k_abortion_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Legal abortion (weeks)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_abortion.gph", replace
drop x k_*  

*refugee
sum refugee
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity refugee [aw = weight], gen(k_refugee_all) at(x) bw(`bw') nograph
kdensity refugee if dem == 1 & leaner == 0 [aw = weight], gen(k_refugee_dem) at(x) bw(`bw') nograph
kdensity refugee if dem == 0 & leaner == 0 [aw = weight], gen(k_refugee_rep) at(x) bw(`bw') nograph
sum k_refugee_dem
scalar maxval = r(max)
sum k_refugee_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum refugee if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_refugee_dem k_refugee_rep k_refugee_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Refugee admissions (thousands/year)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_refugee.gph", replace
drop x k_*

*police
sum police
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity police [aw = weight], gen(k_police_all) at(x) bw(`bw') nograph
kdensity police if dem == 1 & leaner == 0 [aw = weight], gen(k_police_dem) at(x) bw(`bw') nograph
kdensity police if dem == 0 & leaner == 0 [aw = weight], gen(k_police_rep) at(x) bw(`bw') nograph
sum k_police_dem
scalar maxval = r(max)
sum k_police_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum police if `i' == 1 [aw = weight], d
local median_`i' = r(p50)
}
graph twoway line k_police_dem k_police_rep k_police_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Police spending ({c $|}/person)
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_police.gph", replace   
drop x k_*

graph combine "k_localminwage.gph" "k_minwage.gph" "k_sudan.gph" "k_covid.gph" "k_refugee.gph" "k_infrastructure.gph" "k_police.gph" "k_abortion.gph", col(2)
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .style.editstyle declared_xsize(4.5) editcopy
gr_edit .style.editstyle declared_ysize(5.5) editcopy
graph export "Figure2.png", replace as(png)  
foreach i in minwage localminwage sudan covid refugee infrastructure police abortion {
erase "k_`i'.gph"
} 


***Figure 3***
clear
postutil clear
use "CleanedData.dta"
*flip sign of police so that higher values correspond with more liberal positions for all policy areas
replace police = police*-1
drop dem leaner study local
save "ConstraintCleaned.dta", replace

*minwage/sudan
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "sudan"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .3 .05, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/South Sudan
graph save "constraint_`issue1'_`issue2'.gph", replace

*minwage/covid
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "covid"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule -.3 .4 .1, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/COVID relief
graph save "constraint_`issue1'_`issue2'.gph", replace

*minwage/refugee
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "refugee"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .5 .1, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.53
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/Refugees
graph save "constraint_`issue1'_`issue2'.gph", replace

*minwage/infrastructure
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "infrastructure"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .6 .1, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.64
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/Infrastructure
graph save "constraint_`issue1'_`issue2'.gph", replace

*minwage/abortion
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "abortion"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .4 .1, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.43
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/Abortion
graph save "constraint_`issue1'_`issue2'.gph", replace

*minwage/police
clear
use "ConstraintCleaned.dta"
local issue1 = "minwage"
local issue2 = "police"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule -.05 .25 .05, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Minimum wage/Police spending
graph save "constraint_`issue1'_`issue2'.gph", replace

*sudan/covid
clear
use "ConstraintCleaned.dta"
local issue1 = "sudan"
local issue2 = "covid"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule -.2 .3 .1, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush South Sudan/COVID relief
graph save "constraint_`issue1'_`issue2'.gph", replace

*sudan/refugee
clear
use "ConstraintCleaned.dta"
local issue1 = "sudan"
local issue2 = "refugee"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule -.1 .5 .1, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush South Sudan/Refugees
graph save "constraint_`issue1'_`issue2'.gph", replace

*sudan/infrastructure
clear
use "ConstraintCleaned.dta"
local issue1 = "sudan"
local issue2 = "infrastructure"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .4 .1, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.46
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush South Sudan/Infrastructure
graph save "constraint_`issue1'_`issue2'.gph", replace

*refugee/infrastructure
clear
use "ConstraintCleaned.dta"
local issue1 = "refugee"
local issue2 = "infrastructure"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule 0 .5 .1, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.55
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Refugees/Infrastructure
graph save "constraint_`issue1'_`issue2'.gph", replace

*abortion/police
clear
use "ConstraintCleaned.dta"
local issue1 = "abortion"
local issue2 = "police"
keep `issue1' `issue2' weight
drop if `issue1' == . | `issue2' == .
forvalues k = 1/2 {
sort `issue`k''
g `issue`k''rank = weight if _n == 1
replace `issue`k''rank = `issue`k''rank[_n-1] + weight if _n != 1
egen meanrank = mean(`issue`k''rank), by(`issue`k'')
drop `issue`k''rank
rename meanrank `issue`k''rank
egen `issue`k''group = group(`issue`k'')
sum `issue`k''group
local n`issue`k''groups = r(max)
	forvalues i = 2/`n`issue`k''groups' {
	sum `issue`k'' if `issue`k''group == `i'
	g `issue`k''_binary_`i' = `issue`k'' >= r(mean)
	}
drop `issue`k'' `issue`k''group
rename `issue`k''rank `issue`k''
}
postfile Results r `issue1'_cutoff `issue2'_cutoff continuous using "Results.dta", replace
corr `issue1' `issue2' [aw = weight]
post Results (r(rho)) (0) (0) (1) 
forvalues i = 2/`n`issue1'groups' {
forvalues j = 2/`n`issue2'groups' {
corr `issue1'_binary_`i' `issue2'_binary_`j' [aw = weight]
post Results (r(rho)) (`i') (`j') (0) 
}
}
postclose Results
clear
use "Results.dta"
sum r if continuous == 1
local continuous = r(mean)
sum r
local start = floor(r(min)*100)/100
hist r if continuous == 0, xline(`continuous') start(`start') width(.01)
gr_edit .xaxis1.title.text = {}
*gr_edit .xaxis1.title.text.Arrpush R
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .xaxis1.reset_rule -.05 .2 .05, tickset(major) ruletype(range)
gr_edit .xaxis1.plotregion.xscale.curmax = 0.23
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1.plot1.style.editstyle area(shadestyle(color(white "%0"))) editcopy
gr_edit .plotregion1.plot1.style.editstyle area(linestyle(color(black) width(medthin))) editcopy
gr_edit .title.style.editstyle size(medlarge) editcopy
gr_edit .title.text = {}
gr_edit .title.text.Arrpush Abortion/Police spending
graph save "constraint_`issue1'_`issue2'.gph", replace

graph combine "constraint_minwage_sudan.gph" "constraint_minwage_covid.gph" "constraint_minwage_refugee.gph" "constraint_minwage_infrastructure.gph" "constraint_minwage_abortion.gph" "constraint_minwage_police.gph" ///
"constraint_sudan_covid.gph" "constraint_sudan_refugee.gph" "constraint_sudan_infrastructure.gph" "constraint_refugee_infrastructure.gph" "constraint_abortion_police.gph", col(2)
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .style.editstyle declared_xsize(4.5) editcopy
gr_edit .style.editstyle declared_ysize(5.5) editcopy
graph export "Figure3.png", replace as(png) 
erase "constraint_minwage_sudan.gph" 
erase "constraint_minwage_covid.gph"
erase "constraint_minwage_refugee.gph"
erase "constraint_minwage_infrastructure.gph"
erase "constraint_minwage_abortion.gph"
erase "constraint_minwage_police.gph"
erase "constraint_sudan_covid.gph"
erase "constraint_sudan_refugee.gph"
erase "constraint_sudan_infrastructure.gph"
erase "constraint_refugee_infrastructure.gph"
erase "constraint_abortion_police.gph"
erase "Results.dta"
erase "ConstraintCleaned.dta"


***Table 4***
clear
postutil clear
use "CleanedData.dta"
*rescale police in hundreds of dollars per person
replace police = police/100
*top and bottom code to the 1st and 99th percentiles (winsorize)
*if skewness is above .2, recode as log plus 1
foreach i in localminwage minwage sudan covid refugee infrastructure police abortion {
quietly {
sum `i' [aw = weight], d
*noisily:replam aboce `i' = r(p99) if `i' > r(p99) & `i' != .
*replace `i' = r(p1) if `i' < r(p1)
noisily:disp abs(r(p50) - r(mean))/r(sd)
	if abs(r(p50) - r(mean))/r(sd) > .2 {
	replace `i' = log(`i' + 1)
	}
sum `i' [aw = weight]
replace `i' = (`i' - r(mean))/r(sd)
sum `i', d
}
}
*flip sign of police so that higher values correspond with more liberal positions for all policy areas
replace police = police*-1
*drop independents
drop if dem == .
*rescale so 0 is point at which Pr(Dem) == .5
*reweight so that Dems and Reps are equally represented on each question
*code moderation (Dems more conservative or Reps more liberal than the least partisan point)
foreach i in localminwage minwage sudan covid refugee infrastructure police abortion {
sum dem [aw = weight] if `i' != .
g weight_`i' = (1/r(mean))*weight if dem == 1
replace weight_`i' = (1/(1 - r(mean)))*weight if dem == 0
replace weight_`i' = . if `i' == .
logit dem `i' [pw = weight_`i']
disp (-1*_b[_cons])/_b[`i']
replace `i' = `i' - (-1*_b[_cons])/_b[`i']
g moderate_`i' = 0
replace moderate_`i' = 1 if `i' < 0 & dem == 1
replace moderate_`i' = 1 if `i' > 0 & dem == 0
replace moderate_`i' = . if `i' == .
}
logit dem localminwage [pw = weight_localminwage]
outreg2 using "Table4.txt", replace 2aster dec(3)
disp round(1/(1 + exp(-1*(_b[_cons] + _b[localminwage]*1)))*1000)/1000
qui:sum moderate_localminwage [aw = weight] if dem == 1
disp round(r(mean)*1000)/1000
qui:sum moderate_localminwage [aw = weight] if dem == 0
disp round(r(mean)*1000)/1000
foreach i in minwage sudan covid refugee infrastructure police abortion {
logit dem `i' [pw = weight_`i']
outreg2 using "Table4.txt", append 2aster dec(3)
disp round(1/(1 + exp(-1*(_b[_cons] + _b[`i']*1)))*1000)/1000
qui:sum moderate_`i' [aw = weight] if dem == 1
disp round(r(mean)*1000)/1000
qui:sum moderate_`i' [aw = weight] if dem == 0
disp round(r(mean)*1000)/1000
}
*split federal minimum wage analysis by sample, discussed in text
keep if minwage != .
g yougov = study == "YouGov1" | study == "YouGov2"
logit dem minwage [pw = weight_minwage] if yougov == 1
logit dem minwage [pw = weight_minwage] if yougov == 0


***Tables 5, 6, and A2***
clear 
use "CCES23_Common_Output.dta"
g dem = .
replace dem = 1 if pid7 <= 3
replace dem = 0 if pid7 >= 5 & pid7 <= 7
g leaner = pid7 == 3 | pid7 == 5
rename CC23_325 abortion
replace abortion = . if abortion > 40
drop *timing
foreach i of varlist CC23_32* {
rename `i' temp
g `i' = temp == 1
replace `i' = . if temp > 2
drop temp
}
rename commonweight weight
*always allow
rename CC23_324a abortion_binary1
*permit only in case of rape, incest, mother's life in danger
rename CC23_324b abortion_binary2
*make illegal in all circumstances
rename CC23_324c abortion_binary3
*drop if any of the abortion variables are missing so the sample doesn't change between analyses
drop if abortion == . | abortion_binary1 == . | abortion_binary2 == . | abortion_binary3 == .
*recode so liberal is higher and all range from 0-1
replace abortion = abortion/40
replace abortion_binary2 = 1 - abortion_binary2
replace abortion_binary3 = 1 - abortion_binary3
*what share of people who say always allow say 40 weeks?
g fortyweeks = abortion == 1
table abortion_binary1 [aw = weight], statistic(mean fortyweeks)
*what share of people who say illegal in all circumstances say 0 weeks?
g zeroweeks = abortion == 0
table abortion_binary3 [aw = weight], statistic(mean zeroweeks)
g democrat = pid3 == 1
g republican = pid3 == 2
g alwaysallow = abortion_binary1
g neverallow = 1 - abortion_binary3

*Table A2
reg alwaysallow fortyweeks democrat republican [aw = weight], r
outreg2 using "TableA2.txt", replace 2aster dec(3)
reg fortyweeks alwaysallow democrat republican [aw = weight], r
outreg2 using "TableA2.txt", append 2aster dec(3)
reg neverallow zeroweeks democrat republican [aw = weight], r
outreg2 using "TableA2.txt", append 2aster dec(3)
reg zeroweeks neverallow democrat republican [aw = weight], r
outreg2 using "TableA2.txt", append 2aster dec(3)

*create scales
*guns, crime, and safety
factor CC23_321*, fa(1)
predict guns
*immigration
factor CC23_323*, fa(1)
predict immigration
*environment
factor CC23_326*, fa(1)
predict environment
*welfare
factor CC23_328*, fa(1)
predict welfare
*combined
factor CC23_321* CC23_323* CC23_326* CC23_328*
predict combined
foreach i in guns immigration environment welfare combined {
	sum `i'
	replace `i' = (`i' - r(min))/(r(max) - r(min))
	corr `i' abortion
	if r(rho) < 0 {
		replace `i' = 1 - `i'
		}
	}
g biden = presvote20post == 1
replace biden = . if presvote20post > 2
g house = CC23_363 == 2
replace house = . if CC23_363 < 2 | CC23_363 > 3

*Table 5
quietly {
reg guns abortion abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight], r
outreg2 using "Table5.txt", replace 2aster dec(3)
scalar total = e(r2)
reg guns abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight], r
scalar withoutcont = e(r2)
reg guns abortion abortion_binary2 abortion_binary3 [aw = weight], r
scalar without1 = e(r2)
reg guns abortion abortion_binary1 abortion_binary3 [aw = weight], r
scalar without2 = e(r2)
reg guns abortion abortion_binary1 abortion_binary2 [aw = weight], r
scalar without3 = e(r2)
}
disp "guns"
disp round((total - withoutcont)*1000)/1000
disp round((total - without1)*1000)/1000
disp round((total - without2)*1000)/1000
disp round((total - without3)*1000)/1000
foreach i in immigration environment welfare biden house {
quietly {
reg `i' abortion abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight], r
outreg2 using "Table5.txt", append 2aster dec(3)
scalar total = e(r2)
reg `i' abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight], r
scalar withoutcont = e(r2)
reg `i' abortion abortion_binary2 abortion_binary3 [aw = weight], r
scalar without1 = e(r2)
reg `i' abortion abortion_binary1 abortion_binary3 [aw = weight], r
scalar without2 = e(r2)
reg `i' abortion abortion_binary1 abortion_binary2 [aw = weight], r
scalar without3 = e(r2)
}
disp "`i'"
disp round((total - withoutcont)*1000)/1000
disp round((total - without1)*1000)/1000
disp round((total - without2)*1000)/1000
disp round((total - without3)*1000)/1000	
}

*drop DC
drop if inputstate == 11
egen stateid = group(inputstate)
sum stateid
*code political knowledge
g know_ushouse = CC23_310a == 1
g know_ussenate = CC23_310b == 2
g know_sen1party = 0
replace know_sen1party = 1 if CurrentSen1Party == "Democratic" & CC23_311b == 3
replace know_sen1party = 1 if CurrentSen1Party == "Republican" & CC23_311b == 2
replace know_sen1party = 1 if CurrentSen1Party == "Independent" & CC23_311b == 4
replace know_sen1party = . if CurrentSen1Party == " "
g know_sen2party = 0
replace know_sen2party = 1 if CurrentSen2Party == "Democratic" & CC23_311c == 3
replace know_sen2party = 1 if CurrentSen2Party == "Republican" & CC23_311c == 2
replace know_sen2party = 1 if CurrentSen2Party == "Independent" & CC23_311c == 4
replace know_sen2party = . if CurrentSen2Party == " "
g know_govparty = 0
replace know_govparty = 1 if CurrentGovParty == "Democratic" & CC23_311a == 3
replace know_govparty = 1 if CurrentGovParty == "Republican" & CC23_311a == 2
replace know_govparty = . if CurrentGovParty == " "
*check codings
table inputstate, statistic(mean know_*)
tab CurrentSen1Name if inputstate == 4
*Kyrsten Sinema had recently switched to independent, so knowledge of her party is low
tab CurrentSen2Name if inputstate == 6
*Laphonza Butler had just been appointed (to replace Feinstein) and wasn't seeking reelection, so knowledge for her is also low
egen knowledge5 = rmean(know_ushouse know_ussenate know_sen1party know_sen2party know_govparty)
foreach i in abortion abortion_binary1 abortion_binary2 abortion_binary3 {
	g `i'_knowledge = `i'*knowledge5
}
g knowledgeitems = know_ushouse + know_ussenate + know_sen1party + know_sen2party + know_govparty 

*Table 6
reg combined abortion abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight], r
outreg2 using "Table6.txt", replace 2aster dec(3)
forvalues i = 0/5 {
reg combined abortion abortion_binary1 abortion_binary2 abortion_binary3 [aw = weight] if knowledgeitems == `i', r
outreg2 using "Table6.txt", append 2aster dec(3)
}


***Table A1***
clear
use "CleanedData.dta"
keep if weight != .
drop covid leaner localminwage
g rep = dem == 0
g full = 1
foreach i of varlist minwage-abortion {
tab study if `i' != .
}
g minwage_yougov1 = minwage if study == "YouGov1"
g minwage_yougov2 = minwage if study == "YouGov2"
g abortion_ces = abortion if study == "CES2023"
g abortion_yougov2 = abortion if study == "YouGov2"
drop minwage abortion
postfile Results str20 issue str4 sample mean_unweighted median_unweighted sd_unweighted mean_weighted median_weighted sd_weighted n using "TableA1.dta", replace
foreach i in minwage_yougov1 minwage_yougov2 sudan refugee infrastructure police abortion_yougov2 abortion_ces {
foreach j in dem full rep {
preserve
keep if `j' == 1
summarize `i', d
scalar mean_unweighted = r(mean)
scalar median_unweighted = r(p50)
scalar sd_unweighted = r(sd)
scalar n = r(N)
summarize `i' [aw = weight], d
scalar mean_weighted = r(mean)
scalar median_weighted = r(p50)
scalar sd_weighted = r(sd)
post Results ("`i'") ("`j'") (mean_unweighted) (median_unweighted) (sd_unweighted) (mean_weighted) (median_weighted) (sd_weighted) (n) 
restore
}
}
postclose Results
clear
use "TableA1.dta"


***Figure A1***
clear
use "MTurk1.dta"
keep minwageoutcome minwage_dem minwage_rep dem
rename minwageoutcome minwage
g study = "MTurk1"
save "study1.dta", replace
clear
use "MTurk2.dta"
keep dem minwageoutcome minwage_dem minwage_rep
rename minwageoutcome minwage
g study = "MTurk2"
save "study2.dta", replace
clear
use "YouGov.dta"
drop if leaner == 1
keep dem minwageoutcome minwage_in minwage_out weight
g minwage_dem = minwage_in
replace minwage_dem = minwage_out if dem == 0
g minwage_rep = minwage_in
replace minwage_rep = minwage_out if dem == 1
drop minwage_in minwage_out
rename minwageoutcome minwage
g study = "YouGov1"
save "study3.dta", replace
clear
import spss using "UCHI0012_OUTPUT.sav"
keep if pid7 == 1 | pid7 == 2 | pid7 == 6 | pid7 == 7
g dem = pid7 <= 3
g minwage = cv_wage
keep dem minwage weight
g study = "YouGov2"
save "study4.dta", replace
clear
use "study1.dta"
append using "study2.dta"
append using "study3.dta"
append using "study4.dta"
order study dem weight minwage minwage_dem minwage_rep
drop if minwage == .
replace weight = 1 if weight == .
*drop independents to enable comparisons across data sets and conditions
drop if dem == .
rename minwage_dem demcue
rename minwage_rep repcue
*partial out average effects of cues by study and party
egen study_party = group(study dem)
g corrected1 = .
g corrected2 = .
forvalues i = 1/6 {
	reg minwage demcue repcue [aw = weight] if study_party == `i'
	predict res_minwage, residuals
	replace corrected1 = _b[_cons] + 11*_b[repcue] + 11*_b[demcue] + res_minwage if study_party == `i'
	replace corrected2 = _b[_cons] + 7.25*_b[repcue] + 15*_b[demcue] + res_minwage if study_party == `i'
	drop res_minwage
}
g uncorrected = minwage if study != "YouGov2"
g nocue = minwage if study == "YouGov2"
g all = 1
g rep = dem == 0
replace rep = . if dem == .
*top code at 25, bottom code at 0
foreach i in uncorrected corrected1 corrected2 nocue {
replace `i' = 25 if `i' > 25 & `i' != .
replace `i' = 0 if `i' < 0
}
*uncorrected
sum uncorrected
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity uncorrected [aw = weight] , gen(k_uncorrected_all) at(x) bw(`bw') nograph
kdensity uncorrected if dem == 1 [aw = weight] , gen(k_uncorrected_dem) at(x) bw(`bw') nograph
kdensity uncorrected if dem == 0 [aw = weight] , gen(k_uncorrected_rep) at(x) bw(`bw') nograph
sum k_uncorrected_dem
scalar maxval = r(max)
sum k_uncorrected_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum uncorrected [aw = weight] if `i' == 1, d
local median_`i' = r(p50)
}
graph twoway line k_uncorrected_dem k_uncorrected_rep k_uncorrected_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Various Cues
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_uncorrected.gph", replace
drop x k_*
*converged cues
sum corrected1
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity corrected1 [aw = weight] , gen(k_corrected1_all) at(x) bw(`bw') nograph
kdensity corrected1 if dem == 1 [aw = weight] , gen(k_corrected1_dem) at(x) bw(`bw') nograph
kdensity corrected1 if dem == 0 [aw = weight] , gen(k_corrected1_rep) at(x) bw(`bw') nograph
sum k_corrected1_dem
scalar maxval = r(max)
sum k_corrected1_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum corrected1 [aw = weight] if `i' == 1, d
local median_`i' = r(p50)
}
graph twoway line k_corrected1_dem k_corrected1_rep k_corrected1_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Converged Cues
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_corrected1.gph", replace
drop x k_*
*polarized cues
sum corrected2
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity corrected2 [aw = weight] , gen(k_corrected2_all) at(x) bw(`bw') nograph
kdensity corrected2 if dem == 1 [aw = weight] , gen(k_corrected2_dem) at(x) bw(`bw') nograph
kdensity corrected2 if dem == 0 [aw = weight] , gen(k_corrected2_rep) at(x) bw(`bw') nograph
sum k_corrected2_dem
scalar maxval = r(max)
sum k_corrected2_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum corrected2 [aw = weight] if `i' == 1, d
local median_`i' = r(p50)
}
graph twoway line k_corrected2_dem k_corrected2_rep k_corrected2_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush Polarized Cues
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_corrected2.gph", replace
drop x k_*
*nocue
sum nocue
scalar minval = r(min)
scalar maxval = r(max)
g x = r(min) + ((_n - 1)/(_N - 1))*(r(max) - r(min))
local bw = (r(max) - r(min))/50
kdensity nocue [aw = weight] , gen(k_nocue_all) at(x) bw(`bw') nograph
kdensity nocue if dem == 1 [aw = weight] , gen(k_nocue_dem) at(x) bw(`bw') nograph
kdensity nocue if dem == 0 [aw = weight] , gen(k_nocue_rep) at(x) bw(`bw') nograph
sum k_nocue_dem
scalar maxval = r(max)
sum k_nocue_rep
if r(max) > maxval {
scalar maxval = r(max)
}
foreach i in all dem rep {
sum nocue [aw = weight] if `i' == 1, d
local median_`i' = r(p50)
}
graph twoway line k_nocue_dem k_nocue_rep k_nocue_all x, xline(`median_dem') xline(`median_rep') xline(`median_all')
gr_edit .legend.draw_view.setstyle, style(no)
gr_edit .xaxis1.title.text = {}
gr_edit .xaxis1.title.text.Arrpush No Cues
gr_edit .yaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .xaxis1.style.editstyle majorstyle(gridstyle(linestyle(color(white)))) editcopy
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
gr_edit .plotregion1.plot1.style.editstyle line(color(blue) width(medthick)) editcopy
gr_edit .plotregion1.plot2.style.editstyle line(color(red) width(medthick)) editcopy
gr_edit .plotregion1.plot3.style.editstyle line(color(gs8) width(medthick)) editcopy
gr_edit .yaxis1.reset_rule 0 maxval maxval, tickset(major) ruletype(range)
gr_edit .yaxis1.draw_view.setstyle, style(no)
gr_edit .plotregion1._xylines[1].style.editstyle linestyle(color(blue)) editcopy
gr_edit .plotregion1._xylines[3].style.editstyle linestyle(color(gs8)) editcopy
gr_edit .plotregion1._xylines[2].style.editstyle linestyle(color(red)) editcopy
graph save "k_nocue.gph", replace
drop x k_*
graph combine "k_nocue.gph" "k_uncorrected.gph" "k_corrected1.gph" "k_corrected2.gph", col(2)
gr_edit .style.editstyle inner_boxstyle(linestyle(width(none))) editcopy
graph export "FigureA1.png", replace as(png)
forvalues i = 1/4 {  
erase "study`i'.dta"
}
erase "k_nocue.gph"
erase "k_uncorrected.gph"
erase "k_corrected1.gph"
erase "k_corrected2.gph"











